package YAPserver.logic;

import java.util.Random;
import YAPenvironment.*;
@Deprecated
public class PlayGround {

	//List with the players in the game...?
	double[][] edges;
	final int size=YAPconstant.C_GAMESIZE;
	final int half=size/2;
	final int radius=size/2;
	
	int m_players;
	int m_walls;
	double m_radReg;
	double m_centricReg;
	
	/**
	 * The constructor creates the PlayingField
	 * @arg numberOfPlayers
	 * @arg numberOfWalls
	 * @arg radialRegular
	 * @arg centricRegular
	 */
	PlayGround(int numberOfPlayers, int numberOfWalls, double radialRegular, double centricRegular){;
		this.m_players=numberOfPlayers;
		this.m_walls=numberOfWalls;
		this.m_radReg=radialRegular;
		this.m_centricReg=centricRegular;
		edges=new double[m_walls][2];
		
		createPlayField();
	}

	/*
	 * Generates a centric Field CLOCKWISE beginning from 350,200
	 * 0/0---------------------------------->400/0
	 * |					*3rd Point
	 * |
	 * |
	 * |*2nd Point			*200/200 Center
	 * |
	 * |
	 * |					* first Point of a regular 4-Player Map
	 * 0/400---------------------------------400/400
	 * 
	 * centricRegular is used to change the radius random between [centricRegular,1]
	 * radialRegular is used to change the angle random between [centricRegular,1]
	 */
	private void createPlayField() {
		Random rand=new Random();
		for(int i=0; i<m_walls; i++){
			//the angle needs to be randomized to... dont know how atm
			//double random=rand.nextDouble();
			double angle=m_radReg*i*2*Math.PI/m_walls;
			double random=rand.nextDouble()*(1.0-m_centricReg)+m_centricReg;
			double length=radius*random;
			edges[i][0]=Math.cos(angle)*length+ half;	//=x
			edges[i][1]=Math.sin(angle)*length+ half;	//=y
			System.out.println(edges[i][0]+"   "+edges[i][1] +"                "+random+"  "+length);
		}
	}
}
